import Vue from 'vue'
import VueRouter from 'vue-router'
const  Login = () => import('../views/Login.vue')
const Register = () => import('../views/Register.vue')
const Main = () => import('../views/Main/Main.vue')
const Search = () => import('../views/Main/search.vue')
const Test = () => import('../views/Main/Test.vue')
const Question = () => import('../views/Main/questions.vue')
const User = () => import('../views/Main/User.vue')
const Mytest = () => import('../views/User/Mytest.vue')
const Myquestion = () => import('../views/Main/Myquestion.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'register',
    component: Register
  },
  {
    path: '/main',
    component: Main
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/user/:user',
    component: User
  },
  {
    path: '/Mytest/:user',
    component: Mytest
  },
  {
    path: '/test/:id',
    component: Test,
    props: true
  },
  {
    path: '/questions/:id/:value',
    component: Question,
    props: true
  },
  {
    path: '/myquestions/:id',
    component: Myquestion,
    props: true
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
